import requests
from douban.settings import IP_LIST_FILE


def write_proxy_file():
    url = "http://api3.xiguadaili.com/ip/?tid=556187736362707&num=1000"

    res = requests.get(url=url)

    text_list = res.text.split('\r\n')
    with open(IP_LIST_FILE, 'w') as f:
        for i in text_list:
            tmp_str = "https://" + i
            f.write(tmp_str + '\r')

if __name__ == "__main__":
    write_proxy_file()